from pymysql import Connection

# 构建到MySQL数据库的连接
conn = Connection(
    host="localhost",
    port=3306,
    user="root",
    password="123456",
    autocommit=True
)
print(conn.get_server_info())
cursor = conn.cursor()
conn.select_db("test")
cursor.execute("create table student(id INT,name VARCHAR(40),age INT,gender INT)")
cursor.execute("insert into student values (1001,'xxx',31,'男')")
# conn.commit();
conn.close()
